package com.liulin.system.service.impl;

import com.liulin.system.entity.Healthform;
import com.liulin.system.dao.HealthformDao;
import com.liulin.system.service.HealthformService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * (Healthform)表服务实现类
 *
 * @author makejava
 * @since 2021-06-22 19:16:13
 */
@Service("healthformService")
public class HealthformServiceImpl implements HealthformService {
    @Resource
    private HealthformDao healthformDao;

    /**
     * 通过ID查询单条数据
     *
     * @param hno 主键
     * @return 实例对象
     */
    @Override
    public Healthform queryById(Integer hno) {
        return this.healthformDao.queryById(hno);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit  查询条数
     * @return 对象列表
     */
    @Override
    public List<Healthform> queryAllByLimit(int offset, int limit) {
        return this.healthformDao.queryAllByLimit(offset, limit);
    }

    /**
     * 新增数据
     *
     * @param healthform 实例对象
     * @return 实例对象
     */
    @Override
    public Healthform insert(Healthform healthform) {
        this.healthformDao.insert(healthform);
        return healthform;
    }

    /**
     * 修改数据
     *
     * @param healthform 实例对象
     * @return 实例对象
     */
    @Override
    public Healthform update(Healthform healthform) {
        this.healthformDao.update(healthform);
        return this.queryById(healthform.getHno());
    }

    /**
     * 通过主键删除数据
     *
     * @param hno 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer hno) {
        return this.healthformDao.deleteById(hno) > 0;
    }
}
